<template>
	<view class="ss-flex">
		<uni-rate
		:value="modelValue"
		 @change="changeValue" 
		 :readonly="readonly" 
		 :disabled="disabled"
		 :activeColor="activeColor" 
		 :size="size"
		 :allowHalf="allowHalf"
		 ></uni-rate>
		 <view v-if="showText" class="font-color-dark9 ss-m-l-16">{{ modelValue }}星</view>
	</view>
</template>

<script setup>
	import { staticUrl } from '@/sheep/config';
	const props = defineProps({
		modelValue: {
			type: [Number,String],
			default: 1
		},
		readonly: {
			type: Boolean,
			default: false
		},
		allowHalf:{
			type: Boolean,
			default: true
		},
		disabled:{
			type: Boolean,
			default: false
		},
		activeColor: {
			type: String,
			default: '#FFC148'
		},
		activeIcon:{
			type: String,
			default: ''
		},
		inactiveIcon:{
			type: String,
			default: ''
		},
		size:{
			type: [String,Number],
			default: 20,
		},
		gutter:{
			type: String,
			default: '4rpx'
		},
		showText:{
			type: Boolean,
			default: false
		}
	})
	const emit = defineEmits(['update:modelValue'])
	function changeValue(value) {
		if(props.readonly || props.disabled) return
		emit('update:modelValue',value.value)
	}
</script>

<style>

</style>